using System;
using System.Collections.Generic;
using System.Text;
using DTO;
using DAL;


namespace BUS
{
   public class tbchucvuBUS
    {
        public static void Insert(tbchucvuDTO cv)
        {
            tbchucvuDAL tbchucvuDAL = new tbchucvuDAL();
            tbchucvuDAL.Insert(cv);
        }
       public static void Update(tbchucvuDTO cv)
        {
            tbchucvuDAL tbchucvuDAL = new tbchucvuDAL();
            tbchucvuDAL.Update(cv);
        }
        public static void Delete(int iD)
        {
            tbchucvuDAL tbchucvuDAL = new tbchucvuDAL();
            tbchucvuDAL.Delete(iD);
        }
        public static tbchucvuDTOColection GET(string Where, int PageIndex, int PageSize,
                                        string OrderBy, string OrderDirection,
                                        out int TotalRecords)
        {
            tbchucvuDAL tbchucvuDAL = new tbchucvuDAL();
            return tbchucvuDAL.GET(Where, PageIndex, PageSize,
                            OrderBy, OrderDirection, out TotalRecords);
        }
       public static tbchucvuDTO GetByID(int iD)
       {
           int t = 0;
           tbchucvuDAL tbchucvuDAL = new tbchucvuDAL();
           tbchucvuDTOColection cvcolect = tbchucvuDAL.GET("where " + tbchucvuDTOColumn.Machucvu.ToString() + " = " + iD.ToString(), 0, 0,
               tbchucvuDTOColumn.Tenchucvu.ToString(), "ASC", out t);
           if (cvcolect.Count == 1)
               return cvcolect[0];
           return null;
       }
       public static tbchucvuDTOColection GETAll()
       {
           int t = 0;
           tbchucvuDAL tbchucvuDAL = new tbchucvuDAL();
           return tbchucvuDAL.GET("where 1=1", 0, 10, tbchucvuDTOColumn.Tenchucvu.ToString(), "ASC", out t);
       }
    }
}
